home *** CD-ROM | disk | FTP | other *** search
/ Aminet 34 / Aminet 34 (2000)(Schatztruhe)[!][Dec 1999].iso / Aminet / util / gnu / unixcmds.lha / unixcmds / src / grep-2.1 / getpagesize.h < prev    next >
Encoding:
C/C++ Source or Header  |  1999-10-06  |  1006 b   |  42 lines

  1. /* Emulate getpagesize on systems that lack it.  */
  2.  
  3. #ifndef HAVE_GETPAGESIZE
  4.  
  5. # ifdef VMS
  6. #  define getpagesize() 512
  7. # endif
  8.  
  9. # ifdef HAVE_UNISTD_H
  10. #  include <unistd.h>
  11. # endif
  12.  
  13. # ifdef _SC_PAGESIZE
  14. #  define getpagesize() sysconf(_SC_PAGESIZE)
  15. # else /* no _SC_PAGESIZE */
  16. #  ifdef HAVE_SYS_PARAM_H
  17. #   include <sys/param.h>
  18. #   ifdef EXEC_PAGESIZE
  19. #    define getpagesize() EXEC_PAGESIZE
  20. #   else /* no EXEC_PAGESIZE */
  21. #    ifdef NBPG
  22. #     define getpagesize() NBPG * CLSIZE
  23. #     ifndef CLSIZE
  24. #      define CLSIZE 1
  25. #     endif /* no CLSIZE */
  26. #    else /* no NBPG */
  27. #     ifdef NBPC
  28. #      define getpagesize() NBPC
  29. #     else /* no NBPC */
  30. #      ifdef PAGESIZE
  31. #       define getpagesize() PAGESIZE
  32. #      endif /* PAGESIZE */
  33. #     endif /* no NBPC */
  34. #    endif /* no NBPG */
  35. #   endif /* no EXEC_PAGESIZE */
  36. #  else /* no HAVE_SYS_PARAM_H */
  37. #   define getpagesize() 8192    /* punt totally */
  38. #  endif /* no HAVE_SYS_PARAM_H */
  39. # endif /* no _SC_PAGESIZE */
  40.  
  41. #endif /* no HAVE_GETPAGESIZE */
  42.